/*
 * CommandLoop.h
 *
 *  Created on: 2014-3-18
 *      Author: Rome
 */

#include "alt_types.h"

#ifndef COMMANDLOOP_H_
#define COMMANDLOOP_H_

#define TOTAL_LENGTH		0x80

#define	COMMAND_SOF_0		0x1A
#define	COMMAND_SOF_1		0xCF
#define	COMMAND_SOF_2		0xFC
#define	COMMAND_SOF_3		0x1D

#define COMMAND_WRITE		0x01
#define COMMAND_READ		0x00

#define OP_TARGET_EEPROM		0x00
#define OP_TARGET_IIC			0x01
#define OP_TARGET_RS485A		0x02
#define OP_TARGET_RS485B		0x03
#define	OP_RESET				0x04

/*
 * byte		0		1		2		3		4	5		6-7-8-9	10-11-12-13	14-127
 * content	SOF0	SOF1	SOF2	SOF3	OP	RD/WR	address	length		CONTENT(RD/WR)
 *
 * */

alt_32 DecodeRevBuf(alt_u8* RecvBuf, alt_u8* SendBuf, alt_u32 Length);


#endif /* COMMANDLOOP_H_ */
